/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package resources;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

/**
 *
 * @author 
 */
public abstract class ResurcesBase {

    private String baseName;
    private ResourceBundle resourceBundle;
    public String[] baseNames;
    private final Map<String, String> listaBasenames = new HashMap<String, String>();

    public String getBaseName() {
        return baseName;
    }

    public void addBaseName(String name, String path) {
        synchronized (listaBasenames) {
            listaBasenames.put(name, path);
        }

    }

    public void removeBaseName(String name) {
        synchronized (this.listaBasenames) {
            listaBasenames.remove(name);
        }

    }

    public void setBaseName(String baseName) {
        this.baseName = baseName;
    }

    public ResourceBundle getResourceBundle() throws Exception {
        if (this.baseName == null) {
            throw new Exception();
        }
        resourceBundle = ResurcesUtil.getResource(baseName);
        return resourceBundle;
    }

    public Enumeration<String> getAllKeys() {
        return resourceBundle.getKeys();
    }

    public void printKey() {
    }
}
